//
//  GlobalConstant.h
//  huikandian
//
//  Created by ztfgz on 2018/9/18.
//  Copyright © 2018年 ztfgz. All rights reserved.
//

#ifndef GlobalConstant_h
#define GlobalConstant_h


#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

#define NAV_COLOR @"139d59"
#define NAV_TITLE_COLOR @"FFFFFF"

#define APP ((AppDelegate*)([UIApplication sharedApplication].delegate))

#define ROOT_URL  [[[NSBundle mainBundle] infoDictionary] objectForKey:@"DinnerRootURL"]

//#define ROOT_URL APP.baseUrl_Http
//#define ROOT_URL @"http://apiv2.almas.biz"
//
//#define ROOT_URL @"http://192.168.1.5:89"

#define BASE_URL_UG [NSString stringWithFormat:@"%@%@",ROOT_URL,@"/ug/v1"]

#define BASE_URL_ZH [NSString stringWithFormat:@"%@%@",ROOT_URL,@"/zh/v1"]

#define BASE_URL APP.appConfig.lang ? BASE_URL_ZH : BASE_URL_UG

#define PER_PAGE 15

#define ORDER_PER_PAGE 5

// navigation 高度
#define BAS_NAV_HEIGHT 75

#define GET_BASE_URL @"http://api.mulazim.com:8787/ug/v1/home/base-url"


#define GET_PAGE_NUM(X) (X-1)/PER_PAGE+1

#define INTTOSTR(x) [NSString stringWithFormat:@"%d",x]

#define INTEGERTOSTR(x) [NSString stringWithFormat:@"%ld",(long)x]

#define INTEGERTONUMBER(x)  [NSNumber numberWithInteger:x]

#define FILTER_NULL(x)   (x==nil?@"":x)

#define INTTONUMBER(x) [NSNumber numberWithInt:x]

#define FLOATTOSTR(x)  [NSString stringWithFormat:@"%f",x]

//#define WeakSelf __weak typeof(self) weakSelf = self;

#define PAGE_STR @"page"

#define PAGE_SIZE_STR @"limit"



#define BUNDLE APP.bundle

#define LocString(x) NSLocalizedStringFromTableInBundle(x, nil, APP.bundle, nil)

#define NAVIGATIONIMAGE [DinnerTools createImageWithColor:[DinnerTools colorWithHexString:@"109d59"]]

#define BACK_COLOR [DinnerTools colorWithHexString:@"109d59"]

#define PHONE_WIDTH [UIScreen mainScreen].bounds.size.width
#define PHONE_HEIGHT [UIScreen mainScreen].bounds.size.height

#define UI_IS_IPHONE4     ([[UIScreen mainScreen] bounds].size.height < 568.0)
#define UI_IS_IPHONE5     ([[UIScreen mainScreen] bounds].size.height == 568.0)
#define UI_IS_IPHONE6     ([[UIScreen mainScreen] bounds].size.height == 667.0)
#define UI_IS_IPHONE6PLUS ([[UIScreen mainScreen] bounds].size.height == 736.0 || [[UIScreen mainScreen] bounds].size.width == 736.0)

#define DIS_ERROR_ALERT_TIME 3.0

#define CELL_SELECT_BG [[CellSelectionBGView alloc]init]

#endif /* GlobalConstant_h */
